package com.changfeng.trade.audit;
import jakarta.persistence.PrePersist;
import jakarta.persistence.PreUpdate;

import java.time.LocalDateTime;

/**
 * @Author: changfengchen
 * @Date: 2024/10/20 21:19
 * @Description:
 */


public class AuditListener {

    @PrePersist
    public void setCreatedAt(Auditable auditable) {
        auditable.createTime = LocalDateTime.now();
    }

    @PreUpdate
    public void setUpdatedAt(Auditable auditable) {
        auditable.updateTime = LocalDateTime.now();
    }
}

